<template>
    <div class="todoListItem">
        <label>
            <input type="checkbox" @click="$emit('change-state',$event)">{{todo.content}}<span class="btn"></span>
        </label>
    </div>
</template>

<script>
export default {
    props: ['todo'],
}
</script>

<style>
  .todoListItem {
    background: white;
    padding: 16px;
    border-radius: 8px;
    color: #626262;
  }
  .todoListItem label {
    position: relative;
    display: flex;
    align-items: center;
    cursor: pointer;
  }
  .todoListItem.done label {
    text-decoration: line-through;
    font-style: italic;
  }
  .todoListItem label span.btn {
    position: absolute;
    top: 0;
  }
  .todoListItem label span.btn::before,span.btn::after {
    content: "";
    display: block;
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
  }
  .todoListItem label span.btn::before {
    border: 1px solid #b382f9;
  }
  .todoListItem label span.btn::after {
    transition: 0.4s;
    background: #b382f9;
    transform: translate(1px,1px) scale(0.8);
    opacity: 0;
  }

  .todoListItem input {
    margin-right: 16px;
    opacity: 0;
  }
  .todoListItem input:checked + span.btn::after {
    opacity: 1;
  }
</style>